<?php
/**
 *
 *
 */
namespace Yz\modules\Generic;

use Yz_Array,
    Yz_Int;
class Controller_Delete
    extends Controller_AbstractUpdate
{

    /**
     *  forbid access beyond admin panel
     *
     */
    const ACCESS = \Yz_Access_Interface::AC_ADMIN;

    /** The list of required arguments for controller
     *  @var array
     */
    protected $arguments = array(
        'itemId',
    );

    protected $model;
    protected $itemId;


    /****************************
     *      Public methods      *
     ****************************/


    /******************************
     *     Protected methods      *
     ******************************/


    /**
     *  @return this
     *
     */
    protected function updateModel()
    {
        debug();
        if (null === $this->error) {
            try {
                $this->item->delete();
                $this->success = true;
            } catch (Yz_Model_Error $ex) {
                // this is required to show the form again instead of an error template
                $this->error = $ex;
            }
        }
        return $this;
    }



}
